@* Generator: Template TypeVisibility: Internal *@
@using Elmah
@inherits RazorTemplateBase
@{
    // NB cast is not really required, but aids with intellisense!
    var error = (Error) this.Error;
}
<html>
    <head>
        <title>Error: @error.Message</title>
        <style type="text/css">
            body { font-family: verdana, arial, helvetic; font-size: x-small; }
            table.collection { border-collapse: collapse; border-spacing: 0; border: 1px solid black; width: 100% }
            table.collection tr { vertical-align: top; }
            table.collection th { text-align: left; border: 1px solid black; padding: 4px; font-weight: bold; }
            table.collection td { border: 1px solid black; padding: 4px; }
            td, th, pre { font-size: x-small; } 
            #errorDetail { padding: 1em; background-color: #FFFFCC; } 
            #errorMessage { font-size: medium; font-style: italic; color: maroon; }
            h1 { font-size: small; }
        </style>
    </head>
    <body>
        <p id="errorMessage">@error.Type: @error.Message</p>
        @if (error.Time != DateTime.MinValue)
        {
            <p>Generated: @error.Time.ToUniversalTime().ToString("r")</p>
        }
        @if (error.Detail.Length != 0)
        {
@* NOTE! DO NOT REMOVE this comment
   Eliminates white space literal prior to pre tag in generated 
   code and is important for correct formatting
            *@<pre id="errorDetail">@error.Detail</pre>
        }
        @foreach (var collection in 
            from collection in new[] 
            {
                new
                {
                    Id    = "ServerVariables",
                    Title = "Server Variables",
                    Items = error.ServerVariables,
                }
            }
            let data = collection.Items
            where data != null && data.Count > 0
            let items = from i in Enumerable.Range(0, data.Count)
                        select KeyValuePair.Create(data.GetKey(i), data[i])
            select new
            {
                collection.Id, 
                collection.Title,
                Items = items.OrderBy(e => e.Key, StringComparer.OrdinalIgnoreCase)
            }
        )
        {
            <div id="@collection.Id">
                <h1>@collection.Title</h1>
                <table class="collection">
                    <tr><th>Name</th>            
                        <th>Value</th></tr>
                    @foreach (var item in collection.Items)
                    {
                        <tr><td>@item.Key</td>
                            <td>@item.Value</td></tr>
                    }
                </table>
            </div>
        }
        <p>@(RenderPartial<PoweredBy>())</p>
    </body>
</html>
